package com.uniview.service.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.uniview.dao.MailLogDao;
import com.uniview.entity.po.MailLog;
import com.uniview.entity.po.ServiceOrders;
import com.uniview.service.MailLogService;

@Service("mailLogService")
public class MailLogServiceImpl implements MailLogService {

	private Logger logger = Logger.getLogger(MailLogServiceImpl.class);
	
	@Autowired
	private MailLogDao mailLogDao;
	
	@Override
	public int saveMailLog(MailLog mailLog) {
		try {
			return mailLogDao.saveMailLog(mailLog);
		} catch (Exception e) {
			logger.error("保存邮件发送日志信息异常", e);
		}
		return 0;
	}

	@Override
	public List<MailLog> findmailLogBySysdate() {
		try {
			String sql = "select * from sd_mail_log t where t.templatetype = 1 and trunc(t.modifytime) = trunc(Sysdate) and t.flag = 2";
			List<MailLog> list = mailLogDao.findBySql(sql);
			return list;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}
